package com.lagou.homeworkzk;

import com.zaxxer.hikari.HikariDataSource;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;

import javax.sql.DataSource;

@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class})
public class HomeworkZkApplication implements CommandLineRunner {
    @Autowired
    DataSource dataSource;
    public static void main(String[] args) {
        SpringApplication.run(HomeworkZkApplication.class, args);
    }

    @Override
    public void run(String... args) throws Exception {
        System.out.println("DATASOURCE = " + dataSource);
//        HikariDataSource ds=(HikariDataSource)dataSource;
//        System.out.println(ds.isClosed());
//        System.out.println(ds.isRunning());
//        ds.close();
//        System.out.println(ds.isClosed());
//        System.out.println(ds.isRunning());
    }
}
